Skip to main content

Spot Default Projection Specular

(spot:default:PROJECTION:SPECULAR, 0x9aea6be51aa549f9)

This template is referenced 1 time by spot:PROJECTION:SPECULAR.

Technique ambient

Render States

More info can be found on the Direct3D Docs

enum D3DRENDERSTATETYPE {
D3DRS_STENCILENABLE = 1,
D3DRS_STENCILFUNC = 6,
D3DRS_STENCILFAIL = 1,
D3DRS_STENCILMASK = -1,
D3DRS_STENCILPASS = 1,
D3DRS_STENCILREF = 5,
D3DRS_STENCILWRITEMASK = 255,
D3DRS_STENCILZFAIL = 1,
D3DRS_ZENABLE = 1,
D3DRS_ZWRITEENABLE = 0,
D3DRS_ALPHABLENDENABLE = 1,
D3DRS_BLENDOP = 1,
D3DRS_SRCBLEND = 2,
D3DRS_DESTBLEND = 2,
D3DRS_COLORWRITEENABLE = 7,
};

Sampler States

More info can be found on the Direct3D Docs

Sampler 0

enum D3DSAMPLERSTATETYPE {
D3DSAMP_MIPMAPLODBIAS = 827606343,
D3DSAMP_SRGBTEXTURE = 0,
D3DSAMP_ADDRESSU = 3,
D3DSAMP_ADDRESSV = 3,
D3DSAMP_MAGFILTER = 1,
D3DSAMP_MINFILTER = 1,
D3DSAMP_MIPFILTER = 1,
};

Sampler 1

enum D3DSAMPLERSTATETYPE {
D3DSAMP_MIPMAPLODBIAS = 827606343,
D3DSAMP_SRGBTEXTURE = 0,
D3DSAMP_ADDRESSU = 3,
D3DSAMP_ADDRESSV = 3,
D3DSAMP_MAGFILTER = 1,
D3DSAMP_MINFILTER = 1,
D3DSAMP_MIPFILTER = 1,
};

Sampler 2

enum D3DSAMPLERSTATETYPE {
D3DSAMP_MIPMAPLODBIAS = 827606343,
D3DSAMP_SRGBTEXTURE = 1,
D3DSAMP_ADDRESSU = 3,
D3DSAMP_ADDRESSV = 3,
D3DSAMP_MAGFILTER = 2,
D3DSAMP_MINFILTER = 2,
D3DSAMP_MIPFILTER = 2,
};

Shaders

Vertex Shader

column_major float4x4 camera_inv_view_matrix : register(vs_3_0, c4);
float3 camera_unprojection : register(vs_3_0, c10);
float3 ref_light_direction : register(vs_3_0, c9);
float3 ref_light_position : register(vs_3_0, c8);
float3 ref_spot_scale : register(vs_3_0, c7);
float3 render_target_texel_offset : register(vs_3_0, c11);
column_major float4x4 view_proj_matrix : register(vs_3_0, c0);
float3 vp_offset : register(vs_3_0, c12);
float3 vp_size : register(vs_3_0, c13);
struct VertexMain_Output
{
float4 position : POSITION;
float4 texcoord : TEXCOORD;
float4 texcoord1 : TEXCOORD1;
float texcoord2 : TEXCOORD2;
};

VertexMain_Output VertexMain(float4 position : POSITION)
{
VertexMain_Output o;
float4 temp0, temp1;
float3 temp2;
// def c14, 1, 2, -1, 0.5
// dcl_position v0
// dcl_position o0
// dcl_texcoord o1
// dcl_texcoord1 o2
// dcl_texcoord2 o3.x
// mul r0.xyz, c7, v0
temp0.xyz = ref_spot_scale.xyz * position.xyz;
// mov r0.w, c14.x
temp0.w = float1(1);
// dp4 r1.x, r0, c0
temp1.x = dot(temp0, (view_proj_matrix._m00_m10_m20_m30));
// dp4 r1.y, r0, c1
temp1.y = dot(temp0, (view_proj_matrix._m01_m11_m21_m31));
// mul r2.xy, r1, c10
temp2.xy = temp1.xy * camera_unprojection.xy;
// dp4 r2.z, r0, c3
temp2.z = dot(temp0, (view_proj_matrix._m03_m13_m23_m33));
// dp4 r1.z, r0, c2
temp1.z = dot(temp0, (view_proj_matrix._m02_m12_m22_m32));
// dp3 o2.x, r2, c4
o.texcoord1.x = dot(temp2.xyz, (camera_inv_view_matrix._m00_m10_m20_m30).xyz);
// dp3 o2.y, r2, c5
o.texcoord1.y = dot(temp2.xyz, (camera_inv_view_matrix._m01_m11_m21_m31).xyz);
// dp3 o2.z, r2, c6
o.texcoord1.z = dot(temp2.xyz, (camera_inv_view_matrix._m02_m12_m22_m32).xyz);
// mov r0.yw, c14
temp0.yw = float2(2, 0.5);
// mov r2.xy, c13
temp2.xy = vp_size.xy;
// mad r0.xy, c12, r0.y, r2
temp0.xy = vp_offset.xy * temp0.yy + temp2.xy;
// add r0.xy, r0, c14.z
temp0.xy = temp0.xy + float2(-1, -1);
// mul r0.xy, r0, r2.z
temp0.xy = temp0.xy * temp2.zz;
// mad r0.x, r1.x, c13.x, r0.x
temp0.x = temp1.x * vp_size.x + temp0.x;
// mad r0.y, r1.y, -c13.y, r0.y
temp0.y = temp1.y * -vp_size.y + temp0.y;
// add r0.z, r2.z, r2.z
temp0.z = temp2.z + temp2.z;
// mov r1.w, r2.z
temp1.w = temp2.z;
// add r2.xy, r0.w, c11
temp2.xy = temp0.ww + render_target_texel_offset.xy;
// mad o1.x, r0.z, r2.x, r0.x
o.texcoord.x = temp0.z * temp2.x + temp0.x;
// mad o1.y, r0.z, r2.y, r0.y
o.texcoord.y = temp0.z * temp2.y + temp0.y;
// mov o1.w, r0.z
o.texcoord.w = temp0.z;
// mov r0.xyz, c8
temp0.xyz = ref_light_position.xyz;
// dp3 o3.x, r0, c9
o.texcoord2 = dot(temp0.xyz, ref_light_direction.xyz);
// mov o0, r1
o.position = temp1;
// mov o2.w, r1.w
o.texcoord1.w = temp1.w;
// mov o1.z, r1.z
o.texcoord.z = temp1.z;
//

return o;
}

Decompiled by DXDecompiler.

Pixel Shader

column_major float4x4 camera_world_matrix : register(ps_3_0, c0);
sampler2D depth : register(ps_3_0, s1);
sampler2D normal : register(ps_3_0, s0);
float3 ref_light_color : register(ps_3_0, c7);
float3 ref_light_direction : register(ps_3_0, c9);
float ref_light_falloff : register(ps_3_0, c10);
column_major float4x4 ref_light_matrix : register(ps_3_0, c3);
float3 ref_light_position : register(ps_3_0, c8);
float ref_light_start : register(ps_3_0, c11);
sampler2D ref_light_texture : register(ps_3_0, s2);
float ref_spot_angle_falloff : register(ps_3_0, c5);
float ref_spot_projection_scale : register(ps_3_0, c6);
struct PixelMain_Input
{
float4 texcoord : TEXCOORD;
float4 texcoord1 : TEXCOORD1;
float texcoord2 : TEXCOORD2;
};

float4 PixelMain(PixelMain_Input i) : COLOR
{
float4 out_color;
float4 temp0, temp1;
float3 temp2;
// def c12, 1, 0.0001, 0, -0.5
// dcl_texcoord v0.xyw
// dcl_texcoord1 v1
// dcl_texcoord2 v2.x
// dcl_2d s0
// dcl_2d s1
// dcl_2d s2
// rcp r0.x, v0.w
temp0.x = 1.0f / i.texcoord.w;
// mul r0.xy, r0.x, v0
temp0.xy = temp0.xx * i.texcoord.xy;
// texld r1, r0, s1
temp1 = tex2D(depth, temp0.xy);
// texld r0, r0, s0
temp0 = tex2D(normal, temp0.xy);
// add r0.xyz, r0, c12.w
temp0.xyz = temp0.xyz + float3(-0.5, -0.5, -0.5);
// add r0.xyz, r0, r0
temp0.xyz = temp0.xyz + temp0.xyz;
// rcp r0.w, v1.w
temp0.w = 1.0f / i.texcoord1.w;
// mul r1.yzw, r0.w, v1.xxyz
temp1.yzw = temp0.www * i.texcoord1.xyz;
// mad r2.x, r1.y, r1.x, c0.w
temp2.x = temp1.y * temp1.x + (camera_world_matrix._m00_m10_m20_m30).w;
// mad r2.y, r1.z, r1.x, c1.w
temp2.y = temp1.z * temp1.x + (camera_world_matrix._m01_m11_m21_m31).w;
// mad r2.z, r1.w, r1.x, c2.w
temp2.z = temp1.w * temp1.x + (camera_world_matrix._m02_m12_m22_m32).w;
// dp3 r0.w, r2, c9
temp0.w = dot(temp2.xyz, ref_light_direction.xyz);
// add r1.xyz, -r2, c8
temp1.xyz = -temp2.xyz + ref_light_position.xyz;
// add r0.w, r0.w, -v2.x
temp0.w = temp0.w + -i.texcoord2.x;
// add r0.w, r0.w, -c11.x
temp0.w = temp0.w + -ref_light_start.x;
// cmp r1.w, -r0.w, c12.z, c12.x
temp1.w = (-temp0.w >= 0) ? float1(0) : float1(1);
// cmp r0.w, r0.w, -c12.z, -c12.x
temp0.w = (temp0.w >= 0) ? float1(-0) : float1(-1);
// add r0.w, r0.w, r1.w
temp0.w = temp0.w + temp1.w;
// dp3 r1.w, r1, r1
temp1.w = dot(temp1.xyz, temp1.xyz);
// rsq r1.w, r1.w
temp1.w = 1 / sqrt(temp1.w);
// rcp r1.w, r1.w
temp1.w = 1.0f / temp1.w;
// mov r2.x, c12.x
temp2.x = float1(1);
// mad_sat r2.x, r1.w, -c10.x, r2.x
temp2.x = saturate(temp1.w * -ref_light_falloff.x + temp2.x);
// add r1.w, r1.w, c12.y
temp1.w = temp1.w + float1(0.0001);
// rcp r1.w, r1.w
temp1.w = 1.0f / temp1.w;
// mul r1.xyz, r1.w, r1
temp1.xyz = temp1.www * temp1.xyz;
// rsq r1.w, r2.x
temp1.w = 1 / sqrt(temp2.x);
// rcp r1.w, r1.w
temp1.w = 1.0f / temp1.w;
// mul r0.w, r0.w, r1.w
temp0.w = temp0.w * temp1.w;
// dp3 r1.w, r1, -c9
temp1.w = dot(temp1.xyz, -ref_light_direction.xyz);
// add r1.w, -r1.w, c12.x
temp1.w = -temp1.w + float1(1);
// rcp r2.x, c5.x
temp2.x = 1.0f / ref_spot_angle_falloff.x;
// mad r2.x, r1.w, -r2.x, c12.x
temp2.x = temp1.w * -temp2.x + float1(1);
// add_sat r1.w, -r1.w, c5.x
temp1.w = saturate(-temp1.w + ref_spot_angle_falloff.x);
// cmp r1.w, -r1.w, c12.z, c12.x
temp1.w = (-temp1.w >= 0) ? float1(0) : float1(1);
// mul r1.w, r1.w, r2.x
temp1.w = temp1.w * temp2.x;
// mul r0.w, r0.w, r1.w
temp0.w = temp0.w * temp1.w;
// dp3 r0.x, r1, r0
temp0.x = dot(temp1.xyz, temp0.xyz);
// mul r0.x, r0.w, r0.x
temp0.x = temp0.w * temp0.x;
// dp3 r2.x, r1, c3
temp2.x = dot(temp1.xyz, (ref_light_matrix._m00_m10_m20_m30).xyz);
// dp3 r2.y, r1, c4
temp2.y = dot(temp1.xyz, (ref_light_matrix._m01_m11_m21_m31).xyz);
// mul r0.yz, r2.xxyw, c6.x
temp0.yz = temp2.xy * ref_spot_projection_scale.xx;
// mad r0.yz, r0, -c12.w, -c12.w
temp0.yz = temp0.yz * float2(0.5, 0.5) + float2(0.5, 0.5);
// texld r1, r0.yzzw, s2
temp1 = tex2D(ref_light_texture, temp0.yz);
// mul r1, r1.xyzz, c7.xyzz
temp1 = temp1.xyzz * ref_light_color.xyzz;
// add r1, r1, r1
temp1 = temp1 + temp1;
// mul oC0, r0.x, r1
out_color = temp0.x * temp1;
//

return out_color;
}

Decompiled by DXDecompiler.